package com.msmall.base.service.impl;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.msmall.base.dao.BaseDao;
import com.msmall.base.pager.PaginationSupport;
import com.msmall.base.service.BaseManager;


@SuppressWarnings("unchecked")
public class BaseManagerImpl<T, PK extends Serializable> implements
		BaseManager<T, PK> {

	protected final Log log = LogFactory.getLog(getClass());

	protected BaseDao<T, PK> baseDao;
	
	public void setBaseDao(BaseDao<T, PK> baseDao) {
		this.baseDao = baseDao;
	}

	public T get(PK id) {
		return baseDao.get(id);
	}

	public Object get(Class clazz, Serializable id) {
		return baseDao.get(clazz, id);
	}

	public List<T> getAll() {
		return baseDao.getAll();
	}

	public List getAll(Class clazz) {
		return baseDao.getAll(clazz);
	}

	public T save(T object) {
		return baseDao.save(object);
	}
	public Object saveObject(Object obj){
		return baseDao.saveObject(obj);
	}
	public void remove(PK id) {
		baseDao.remove(id);
	}

	public void remove(Class clazz, Serializable id) {
		baseDao.remove(clazz, id);
	}
	
	public boolean exists(PK id) {
		return baseDao.exists(id);
	}
	public boolean exists(Class clazz, Serializable id){
		return baseDao.exists(clazz, id);
	}
	
	public void getPagination(PaginationSupport page) {
		baseDao.getPagination(page);
	}



}
